1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
// array::operator[]
#include <iostream>
#include <array>
int main ()
{
std::array<int,10> myarray;
unsigned int i;
// assign some values:
for (i=0; i<10; i++) myarray[i]=i;
// print content
std::cout << "myarray contains:";
for (i=0; i<10; i++)
std::cout << ' ' << myarray[i];
std::cout << '\n';
return 0;
}
| |